package com.ipzoe.common.retrofit.service;

import com.ipzoe.common.retrofit.request.Conversation;
import com.ipzoe.common.retrofit.request.ConversationMember;
import com.ipzoe.common.retrofit.request.LeanCloudKick;
import com.ipzoe.common.retrofit.request.LeanCloudPushMessage;
import com.ipzoe.common.retrofit.response.BaseSuccess;
import retrofit2.Call;
import retrofit2.http.*;

/**
 * LeanCloudService
 * <p>
 * Created 2018/01/19.
 *
 * @author pfzhang
 */
public interface LeanCloudService {

    /**
     * 创建会话
     *
     * @param appKeyHeader LeanCloud appKey
     * @param conversation 会话对象
     * @return LeanCloud响应
     */
    @POST("1.1/classes/_Conversation")
    Call<BaseSuccess> createConversation(@Header("X-LC-Key") String appKeyHeader, @Body Conversation conversation);

    /**
     * 会话增加或删除成员
     *
     * @param appKeyHeader       LeanCloud appKey
     * @param conversationId     会话ID
     * @param conversationMember 会话增减成员对象
     * @return 响应
     */
    @PUT("1.1/classes/_Conversation/{conversationId}")
    Call<Object> addOrRemoveMember(@Header("X-LC-Key") String appKeyHeader, @Path("conversationId") String conversationId,
                                   @Body ConversationMember conversationMember);

    /**
     * 推送消息
     *
     * @param masterKeyHeader LeanCloud masterKey
     * @param pushMessage     LeanCloud推送消息实体
     * @return LeanCloud响应
     */
    @POST("1.1/push")
    Call<BaseSuccess> push(@Header("X-LC-Key") String masterKeyHeader, @Body LeanCloudPushMessage pushMessage);

    /**
     * 强制下线
     *
     * @param masterKeyHeader LeanCloud masterKey
     * @param kick            强制下线实体
     * @return 响应
     */
    @POST("1.1/rtm/client/kick")
    Call<Object> kick(@Header("X-LC-Key") String masterKeyHeader, @Body LeanCloudKick kick);

}
